#ifndef VM_MMAP_H
#define VM_MMAP_H

#include "stdbool.h"
#include "stdint.h"
#include "hash.h"

struct mmap
{
	int mmap_id;
	void *uaddr;
	struct hash_elem hash_elem;
};

struct semaphore mmap_sema;

bool mmap_init(void);

int syscall_mmap(int fd, void *addr);

bool syscall_munmap(int mmap_id);

void mmap_deallocate(struct thread *t);

void mmap_destructor(struct hash_elem *h_elem,void *aux UNUSED );

unsigned
mmap_hash (const struct hash_elem *p_, void *aux UNUSED);


bool
mmap_less (const struct hash_elem *a_, const struct hash_elem *b_,
		void *aux UNUSED);

struct mmap *
mmap_lookup (int mmap_id, struct thread *t);

#endif
